$(function() {
	$('#vue_vm_list div').hide();
});

var invoiceApply = {
	invoiceApplyId: '',
	startNumber: '',
	endNumber: '',
	applyTime: '',
	applyId: '',
	applyName: '',
	quantity: '',
	approveResult: '',
	getStatus: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	createTime: '',
	updateTime: '',
};

var view = {
	data: invoiceApply
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

function save() {
	if(!isPositiveInt(view.data.startNumber) || !isPositiveInt(view.data.endNumber)) {
		alert('起始号、结束号都必须为正整数');
		return;
	}
	
	view.data.quantity = 1+parseInt(view.data.endNumber)-parseInt(view.data.startNumber);
	view.data.approveResult = (view.data.approveResult==''? 0: parseInt(view.data.approveResult));
	view.data.getStatus = (view.data.getStatus==''? 0: parseInt(view.data.getStatus));
	
	save_basic(path+'/invoiceApply/save', {invoiceApply:view.data}, function() {
		alert('发票申请保存成功');
	});
}